package com.haoshuang.zhouzhoubang.ui.dialog

import android.content.Context
import com.haoshuang.zhouzhoubang.R
import com.haoshuang.zhouzhoubang.databinding.DialogTeamGroupMenuBinding
import com.lxj.xpopup.core.BottomPopupView
import com.mufeng.libs.utils.view.click
import com.mufeng.libs.utils.view.clickWithTrigger

class TeamGroupMenuDialog(
    context: Context,
    private val content: String = "",
    private val onChoose: (type: Int) -> Unit
) : BottomPopupView(context) {

    private lateinit var binding: DialogTeamGroupMenuBinding

    override fun getImplLayoutId(): Int {
        return R.layout.dialog_team_group_menu
    }

    override fun onCreate() {
        super.onCreate()
        binding = DialogTeamGroupMenuBinding.bind(popupImplView)

        binding.tvTitle.text = "${content}分组管理"

        binding.ivClose.click { dismiss() }
        binding.tvEdit.clickWithTrigger {
            dismiss()
            onChoose(1)
        }

        binding.tvAddMember.clickWithTrigger {
            dismiss()
            onChoose(2)
        }

        binding.tvRemoveMember.clickWithTrigger {
            dismiss()
            onChoose(3)
        }
        binding.tvDelGroup.clickWithTrigger {
            dismiss()
            onChoose(4)
        }
    }

}